package chat.servlet;

import java.io.IOException;
import java.net.URLEncoder;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import chat.user.UserBean;

public class LoginAction extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String path = req.getContextPath();
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		
		//获取参数
		String uname=req.getParameter("name");
		String upwd=req.getParameter("pwd");
		
		//业务逻辑
		String msg = "false";
		req.getSession().setAttribute("name", uname);
		resp.sendRedirect(path+"/Chatview");
		/*if("liuhuan".equals(uname)&&"123".equals(upwd)){
			req.getSession().setAttribute("name", uname);
			resp.sendRedirect(path+"/Chatview");
			return ;
		}		else{
			msg=URLEncoder.encode(msg,"utf-8");
			resp.sendRedirect(path+"/Login?msg="+msg);
			return ;
		}*/
		
	}

}
